package javaAdvanced;

/**
 * @author cuiH
 * Date: 13-10-22
 * 内部类的测试例子，通过内部方法调用内部类达到实现的效果
 */
public class Outer {
    public static void main(String[] args) {
        Outer outer = new Outer();
        Outer.Inner inner = outer.new Inner();
        inner.print("Outer.new");

        inner = outer.getInner();
        inner.print("Outer.get");
    }
    //通过成员方法调用内部类
    public Inner getInner(){
        return new Inner();
    }

    public class Inner{
        public void print(String str){
            System.out.println(str);
        }
    }
}
